package com.kly.order.db.dao;

import com.fqgj.common.base.BaseMapper;
import com.kly.order.db.entity.MemberBenefitsEntity;

import java.util.List;
import java.util.Map;

public interface MemberBenefitsDao extends BaseMapper<MemberBenefitsEntity> {

    List<MemberBenefitsEntity> selectByMemberCode(Map<String, Object> params);

    List<MemberBenefitsEntity> selectByMemberCodeAndTimesUsed(Map<String, Object> params);

    List<MemberBenefitsEntity> findLatestExpiryDatesByMemberCode(Map<String, Object> params);

    int batchInsert(List<MemberBenefitsEntity> list);

    List<MemberBenefitsEntity> findAvailableServices(Map<String, Object> params);

    /**
     * 读取权益的剩余次数
     * @param userCode
     * @param benefitCode
     * @return
     */
    Integer selectFlashChatNum(String userCode,Integer benefitCode);

    /**
     * 获取用户会员权益（包括已已过期会员但未消费的权益记录）
     */
    List<MemberBenefitsEntity> findAllBenefit(String userCode);
}